$(document).ready(function() {
  var $table = $('#worker-table');
  $table.bootstrapTable({
    data: data,
    pagination: true,
    pageSize: 10
  });
});

var data = [
  {
    field1: 'BG0021231',
    field2: 'Z01标',
    field3: 'G220公路工程指挥部',
    field4: '阜阳科信检测',
    field5: '2014.02.02'
  },
  {
    field1: 'BG0021231',
    field2: 'Z01标',
    field3: 'G220公路工程指挥部',
    field4: '阜阳科信检测',
    field5: '2014.02.02'
  },
  {
    field1: 'BG0021231',
    field2: 'Z01标',
    field3: 'G220公路工程指挥部',
    field4: '阜阳科信检测',
    field5: '2014.02.02'
  },
  {
    field1: 'BG0021231',
    field2: 'Z01标',
    field3: 'G220公路工程指挥部',
    field4: '阜阳科信检测',
    field5: '2014.02.02'
  },
];

function getCheckBox(id, row) {
  var html = '<input type="checkbox" name="checkbox" sid="' + id + '">';
  return html;
}

//用户，全选/全不选
function selectAll(ele) {
  var bool = $(ele).is(':checked');
  $('input[name="checkbox"]').prop("checked", bool);
};

// 操作Qr code is generated
function clickOperate(id, row) {
  var roleIds = row.roleIds;
  // 传值给click事件
  return "<a class='qn-check' onclick='getCode(`" + id + "`)'>生成二维码</a>";
}

// 显示增加
function showAdd() {
  $('#addForm_div').modal('show');
}

// 生成二维码
function getCode() {
  $('#get-code').modal('show');
}

// 删除
function deleteReport() {
  var ids = $.map($('input[name="checkbox"]'), function (item) {
    if ($(item).is(':checked')) {
      return $(item).attr("sid");
    }
  });
  if(ids.length == 0){
    showAlert(null,"请选择数据后再删除");
    return;
  }
  showConfirm("提示","是否确定删除？",function() {
    
  });
}